/* 博客基础样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

[data-theme="dark"] body {
    color: #e0e0e0;
    background-color: #121212;
}

/* 导航栏主题适配 */
.navbar {
    background-color: #2c3033 !important; /* 默认深色背景，比主体背景稍亮 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

[data-theme="light"] .navbar {
    background-color: #e9ecef !important; /* 浅色主题使用中等灰色背景，与主体背景有区别 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

[data-theme="dark"] .navbar {
    background-color: #1a1a1a !important; /* 深色主题使用稍亮的黑色背景，与主体背景有区别 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.navbar-brand, .nav-link {
    color: #f8f9fa !important; /* 默认使用白色文字 */
}

[data-theme="light"] .navbar-brand,
[data-theme="light"] .nav-link {
    color: #333 !important; /* 浅色主题使用深灰色文字 */
}

[data-theme="dark"] .navbar-brand,
[data-theme="dark"] .nav-link {
    color: #e0e0e0 !important; /* 深色主题使用浅灰色文字 */
}

.navbar-brand:hover, .nav-link:hover {
    color: #64b5f6 !important; /* 悬停时使用蓝色 */
}

/* 博客容器 */
.blog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 博客内容包装器 - 双栏布局 */
.blog-content-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 20px;
}

/* 主内容区域 */
.blog-post-list, .blog-post-detail {
    flex: 3;
    min-width: 300px;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

[data-theme="dark"] .blog-post-list, 
[data-theme="dark"] .blog-post-detail {
    background: #1e1e1e;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    color: #e0e0e0;
}

/* 博客文章容器 */
.blog-posts-container {
    flex: 3;
    min-width: 300px;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

[data-theme="dark"] .blog-posts-container {
    background: #1e1e1e;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    color: #e0e0e0;
}

/* 标签云侧边栏 */
.tag-cloud-sidebar {
    flex: 1;
    min-width: 250px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    align-self: flex-start;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

[data-theme="dark"] .tag-cloud-sidebar {
    background: #1e1e1e;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    color: #e0e0e0;
}

/* 博客标题 */
.blog-post-list h1, .blog-post-detail h1, .blog-posts-container h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

[data-theme="dark"] .blog-post-list h1, 
[data-theme="dark"] .blog-post-detail h1, 
[data-theme="dark"] .blog-posts-container h1 {
    color: #bbdefb;
    border-bottom: 2px solid #64b5f6;
}

/* 博客文章标题 */
.blog-post h2 {
    color: #34495e;
    margin: 0 0 15px 0;
}

[data-theme="dark"] .blog-post h2 {
    color: #e0e0e0;
}

/* 博客文章元信息 */
.blog-post .meta {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-bottom: 15px;
}

[data-theme="dark"] .blog-post .meta {
    color: #9e9e9e;
}

/* 博客文章摘要 */
.blog-post .summary {
    margin-bottom: 20px;
    color: #333;
}

[data-theme="dark"] .blog-post .summary {
    color: #e0e0e0;
}

/* 标签样式 */
.tag {
    display: inline-block;
    padding: 5px 10px;
    margin: 5px;
    border-radius: 20px;
    font-size: 0.9em;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
}

.tag:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

/* 标签颜色类 */
.tag-color-1 { background-color: #3498db; }
.tag-color-2 { background-color: #2ecc71; }
.tag-color-3 { background-color: #e74c3c; }
.tag-color-4 { background-color: #f39c12; }
.tag-color-5 { background-color: #9b59b6; }
.tag-color-6 { background-color: #1abc9c; }
.tag-color-7 { background-color: #d35400; }
.tag-color-8 { background-color: #34495e; }
.tag-color-9 { background-color: #e67e22; }
.tag-color-10 { background-color: #16a085; }

/* 深色主题下的标签样式 */
[data-theme="dark"] .tag {
    color: white;
}

[data-theme="dark"] .tag-color-1 { background-color: #5dade2; }
[data-theme="dark"] .tag-color-2 { background-color: #58d68d; }
[data-theme="dark"] .tag-color-3 { background-color: #ec7063; }
[data-theme="dark"] .tag-color-4 { background-color: #f8c471; }
[data-theme="dark"] .tag-color-5 { background-color: #bb8fce; }
[data-theme="dark"] .tag-color-6 { background-color: #48c9b0; }
[data-theme="dark"] .tag-color-7 { background-color: #eb984e; }
[data-theme="dark"] .tag-color-8 { background-color: #566573; }
[data-theme="dark"] .tag-color-9 { background-color: #f0b27a; }
[data-theme="dark"] .tag-color-10 { background-color: #45b39d; }

/* 标签云标题 */
.tag-cloud-sidebar h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    color: #2c3e50;
}

[data-theme="dark"] .tag-cloud-sidebar h3 {
    border-bottom: 1px solid #444;
    color: #bbdefb;
}

/* 分页导航 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    list-style: none;
}

.pagination li {
    margin: 0 5px;
}

.pagination a, .pagination span {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    background: #ecf0f1;
    color: #34495e;
    border-radius: 4px;
    transition: all 0.3s ease;
}

[data-theme="dark"] .pagination a, 
[data-theme="dark"] .pagination span {
    background: #333;
    color: #e0e0e0;
}

.pagination a:hover {
    background: #3498db;
    color: white;
}

[data-theme="dark"] .pagination a:hover {
    background: #64b5f6;
    color: #121212;
}

.pagination .active span {
    background: #3498db;
    color: white;
}

[data-theme="dark"] .pagination .active span {
    background: #64b5f6;
    color: #121212;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .blog-content-wrapper {
        flex-direction: column;
    }
    
    .tag-cloud-sidebar {
        position: static;
        max-height: none;
    }
    
    .blog-container {
        padding: 10px;
    }
    
    .blog-post-list, .blog-post-detail, .blog-posts-container, .tag-cloud-sidebar {
        padding: 20px;
    }
}

/* 博客文章内容样式 */
.blog-post-detail .content {
    margin-top: 20px;
    color: #333;
}

[data-theme="dark"] .blog-post-detail .content {
    color: #e0e0e0;
}

.blog-post-detail .content h2 {
    color: #2c3e50;
    margin-top: 30px;
}

[data-theme="dark"] .blog-post-detail .content h2 {
    color: #bbdefb;
}

.blog-post-detail .content p {
    margin-bottom: 20px;
    color: #333;
}

[data-theme="dark"] .blog-post-detail .content p {
    color: #e0e0e0;
}

/* 代码块样式 */
pre {
    background-color: #f8f9fa;
    border-radius: 5px;
    padding: 15px;
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid #e9ecef;
    font-size: 0.9em;
    line-height: 1.4;
}

[data-theme="dark"] pre {
    background-color: #2e2e2e;
    border: 1px solid #444;
    color: #e0e0e0;
}

code {
    font-family: 'Consolas', 'Courier New', monospace;
    background-color: #f8f9fa;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

[data-theme="dark"] code {
    background-color: #2e2e2e;
    color: #e0e0e0;
}

pre code {
    background: none;
    padding: 0;
}

/* 语法高亮样式 */
pre code .hljs-comment,
pre code .hljs-quote {
    color: #998;
    font-style: italic;
}

pre code .hljs-keyword,
pre code .hljs-selector-tag,
pre code .hljs-subst {
    color: #333;
    font-weight: bold;
}

pre code .hljs-number,
pre code .hljs-literal,
pre code .hljs-variable,
pre code .hljs-template-variable,
pre code .hljs-tag .hljs-attr {
    color: #008080;
}

pre code .hljs-string,
pre code .hljs-doctag {
    color: #d14;
}

pre code .hljs-title,
pre code .hljs-section,
pre code .hljs-selector-id {
    color: #900;
    font-weight: bold;
}

pre code .hljs-subst {
    font-weight: normal;
}

pre code .hljs-type,
pre code .hljs-class .hljs-title {
    color: #458;
    font-weight: bold;
}

pre code .hljs-tag,
pre code .hljs-name,
pre code .hljs-attribute {
    color: #000080;
    font-weight: normal;
}

pre code .hljs-regexp,
pre code .hljs-link {
    color: #009926;
}

pre code .hljs-symbol,
pre code .hljs-bullet {
    color: #990073;
}

pre code .hljs-built_in,
pre code .hljs-builtin-name {
    color: #0086b3;
}

pre code .hljs-meta {
    color: #999;
    font-weight: bold;
}

pre code .hljs-deletion {
    background: #fdd;
}

pre code .hljs-addition {
    background: #dfd;
}

pre code .hljs-emphasis {
    font-style: italic;
}

pre code .hljs-strong {
    font-weight: bold;
}

/* 深色主题下的语法高亮 */
[data-theme="dark"] pre code .hljs-comment,
[data-theme="dark"] pre code .hljs-quote {
    color: #999;
}

[data-theme="dark"] pre code .hljs-keyword,
[data-theme="dark"] pre code .hljs-selector-tag,
[data-theme="dark"] pre code .hljs-subst {
    color: #fff;
}

[data-theme="dark"] pre code .hljs-number,
[data-theme="dark"] pre code .hljs-literal,
[data-theme="dark"] pre code .hljs-variable,
[data-theme="dark"] pre code .hljs-template-variable,
[data-theme="dark"] pre code .hljs-tag .hljs-attr {
    color: #008080;
}

[data-theme="dark"] pre code .hljs-string,
[data-theme="dark"] pre code .hljs-doctag {
    color: #d14;
}

[data-theme="dark"] pre code .hljs-title,
[data-theme="dark"] pre code .hljs-section,
[data-theme="dark"] pre code .hljs-selector-id {
    color: #900;
}

[data-theme="dark"] pre code .hljs-type,
[data-theme="dark"] pre code .hljs-class .hljs-title {
    color: #458;
}

[data-theme="dark"] pre code .hljs-tag,
[data-theme="dark"] pre code .hljs-name,
[data-theme="dark"] pre code .hljs-attribute {
    color: #000080;
}

/* 视频容器样式 */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 宽高比 */
    height: 0;
    overflow: hidden;
    margin: 20px 0;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 5px;
}

.bilibili-video,
.youtube-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 5px;
}

/* 标签页样式 */
.tags-page {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    color: #333;
}

[data-theme="dark"] .tags-page {
    background: #1e1e1e;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    color: #e0e0e0;
}

.tags-page h1 {
    color: #2c3e50;
    margin-bottom: 30px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

[data-theme="dark"] .tags-page h1 {
    color: #bbdefb;
    border-bottom: 2px solid #64b5f6;
}

/* 管理员登录页面样式 */
.admin-login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background-color: #f8f9fa;
}

[data-theme="dark"] .admin-login-container {
    background-color: #121212;
}

.admin-login-container .card {
    width: 100%;
    max-width: 1200px; /* 与博客页面主体内容宽度保持一致 */
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .admin-login-container .card {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
    background: #1e1e1e;
    color: #e0e0e0;
}

.admin-login-container .card-body {
    max-width: 500px; /* 限制表单区域宽度，保持居中 */
    margin: 0 auto;
    padding: 2rem;
}

.admin-login-container .card-header {
    background-color: #343a40;
    color: white;
    text-align: center;
    border-bottom: none;
    border-radius: calc(0.375rem - 1px) calc(0.375rem - 1px) 0 0;
}

/* 管理员容器样式 */
.admin-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.admin-container .card {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-bottom: 20px;
    background: white;
    color: #333;
}

[data-theme="dark"] .admin-container .card {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
    background: #1e1e1e;
    color: #e0e0e0;
}

.admin-container .card-header {
    background-color: #343a40;
    color: white;
    border-bottom: none;
}

/* 管理员表单样式 */
.admin-form-group {
    margin-bottom: 1rem;
}

.admin-form-label {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
}

[data-theme="dark"] .admin-form-label {
    color: #e0e0e0;
}

.admin-form-control {
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    background-color: white;
    color: #333;
}

[data-theme="dark"] .admin-form-control {
    background-color: #2e2e2e;
    border: 1px solid #444;
    color: #e0e0e0;
}

.admin-form-control:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

[data-theme="dark"] .admin-form-control:focus {
    border-color: #64b5f6;
    box-shadow: 0 0 0 0.2rem rgba(100, 181, 246, 0.25);
}

/* 管理员按钮样式 */
[data-theme="dark"] .admin-form-control:focus {
    border-color: #64b5f6;
    box-shadow: 0 0 0 0.2rem rgba(100, 181, 246, 0.25);
}

.admin-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.admin-btn-primary {
    background-color: #007bff;
    color: white;
}

[data-theme="dark"] .admin-btn-primary {
    background-color: #1976d2;
}

.admin-btn-primary:hover {
    background-color: #0056b3;
}

[data-theme="dark"] .admin-btn-primary:hover {
    background-color: #1565c0;
}

.admin-btn-secondary {
    background-color: #6c757d;
    color: white;
}

[data-theme="dark"] .admin-btn-secondary {
    background-color: #757575;
}

.admin-btn-secondary:hover {
    background-color: #545b62;
}

[data-theme="dark"] .admin-btn-secondary:hover {
    background-color: #616161;
}

/* 管理员表格样式 */
.admin-table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    background-color: transparent;
    border-collapse: collapse;
}

[data-theme="dark"] .admin-table {
    color: #e0e0e0;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
}

[data-theme="dark"] .admin-table th,
[data-theme="dark"] .admin-table td {
    border-top: 1px solid #444;
}

[data-theme="dark"] .admin-table th,
[data-theme="dark"] .admin-table td {
    border-top: 1px solid #444;
}

.admin-table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background-color: #e9ecef;
}

[data-theme="dark"] .admin-table thead th {
    border-bottom: 2px solid #444;
    background-color: #2e2e2e;
}

.admin-table tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .admin-table tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.05);
}

/* 管理员警告框样式 */
.admin-alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

.admin-alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

[data-theme="dark"] .admin-alert-danger {
    color: #ffcdd2;
    background-color: #421c24;
    border-color: #6d4147;
}

.admin-alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

[data-theme="dark"] .admin-alert-success {
    color: #c8e6c9;
    background-color: #1b3524;
    border-color: #3b634b;
}

/* 管理员布局样式 */
.admin-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
}

[data-theme="dark"] .admin-layout {
    background-color: #121212;
}

.admin-header {
    flex-shrink: 0;
}

.admin-main {
    flex: 1;
    padding: 20px 0;
}

/* 主页样式 */
.home-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .admin-container {
        padding: 10px;
    }
    
    .admin-login-container {
        padding: 10px;
    }
    
    .admin-login-container .card {
        max-width: 100%;
    }
}